{% if not environment.web %}
{% extends 'index.html' %}
{% endif %}
<script>
$("a.torna_allo_storico").click(function() {
        $("div#daoaddedit").show();
        $("div#scrollingDiv").show();
        $("div#riepilogo").hide()
        //var fields = $(":input").serializeArray();
        //$('div#step5').load('/anteprima_metodo',{"stampa":"0", "f":fields});
});
{% include "ip_js.js" with context %}
</script>
{% include "giustopeso/azioni_prof.html" with context %}
<br>
<div class="TitCliente">Dettaglio Ordine di {{pageData["daoCliente"].ragione_sociale}}</div>
{% block body %}
    {% if dao %}
    {% set tota = dao.totali %}
    <table cellpadding="4" cellspacing="1" border="0">
        <tr>
            <td style="font-size:18px;" class="report-header">Numero:</td><td style="font-size:18px;">{{dao.numero}} {{dao.parte|nonone}}</strong></h3></td>

            <td class="report-header">Tipo:</td><td><strong> {{(dao.registro_numerazione).replace("_"," ").capitalize()}}</strong></td>
        </tr>
        <tr>
            <td style="width:100px;" class="even-detail">Operazione</td>
            <td style="font-size:18px;width:250px;" class="odd-detail">
                <strong> {{dao.operazione}}</strong></td>
            <td class="even-detail">Data documento</td>
            <td class="odd-detail" style="font-size:16px;"><strong>{{utils.dateToString(dao.data_documento)}}</strong></td>
        </tr>
        {% if dao.id_cliente %}
        <tr>
            <td class="even-detail">Cliente</td>
            <td colspan="3" style="font-size:16px;" class="odd-detail"><strong>{{dao.intestatario}}</strong></td>
        </tr>
        {% endif %}
        {% if dao.id_fornitore %}
        <tr>
            <td class="even-detail">Fornitore</td>
            <td colspan="3" style="font-size:16px;" class="odd-detail"><strong>{{dao.intestatario}}</strong></td>
        </tr>
         {% endif %}
    </table>
    <br />
            <table cellpadding="4" cellspacing="1" border="0">
                <tr>
                    <td colspan="8" class="table-header">TOTALI DOCUMENTO</td>
                </tr>
                <tr>
                    <td colspan="8" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
                </tr>
                <tr>
                    <td class="even-detail">IMPONIBILE LORDO:</td>
                    <td style="width:70px;" class="odd-detail"><strong>{{utils.mNLC(dao._totaleImponibile,2)}}</strong></td>

                    <td class="even-detail">SCONTO TESTATA DOCUMENTO:</td>
                    <td class="odd-detail"><strong> {{ utils.getStringaSconti(utils.getScontiFromDao(dao.sconti, dao.applicazione_sconti)[0])}}{{ utils.getScontiFromDao(dao.sconti, dao.applicazione_sconti)[1]}}</strong></td>
                    <td class="even-detail">IMPONIBILE:</td>
                    <td style="width:70px;" class="odd-detail"><strong> {{ utils.mNLC(dao._totaleImponibileScontato,2)}}</strong></td>
                    <td class="even-detail">IMPOSTA:</td>
                    <td style="width:70px;" class="odd-detail"><strong>{{ utils.mNLC(dao._totaleImpostaScontata,2)}}</strong></td>
                </tr>
                <tr>
                    <td  class="even-detail">TOTALE:</td>
                    <td colspan="7"class="odd-detail" style="font-size:20px;color:#F58D36;"><strong>{{utils.mNLC(dao._totaleScontato,2)}}</strong></td>
                </tr>
                <tr>
                    <td colspan="8" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
                </tr>
            </table>
    <br />
        <table cellpadding="4" cellspacing="1" border="0">
            <tr >
                <td colspan="20" class="table-header">Dettaglio documento</td>
            </tr>
            <tr><td colspan="20" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
            <tr>
                <th class="even-detail">N.</th>
                <th class="even-detail">MAGAZZINO</th>
                <th class="even-detail">CODICE ART</th>
                <th class="even-detail" align="center">DESCRIZIONE ARTICOLO</th>
        <th colspan="2" class="even-detail">LISTINO</th>
        <th colspan="2" class="even-number">Prezzo Lordo</th>
                <th colspan="2" class="even-number">Sconto</th>
                        <th colspan="2" class="even-number">Prezzo Netto</th>
        <th colspan="2" class="even-number">Quantita'</th>
                <th colspan="2" class="even-number">M.plo</th>
                <th colspan="2" class="even-number">% Iva</th>
                <th colspan="3" class="even-number">Totale</th>
            </tr>

        {% for riga in dao.righe %}
            <tr >
                <td class="odd-detail">{{loop.index}}</td>
                <td class="odd-detail">{{(riga.magazzino|nonone)[:15]}}</td>
                <td class="odd-detail"><b><a href="program:/articoloId={{riga.id_articolo}}">{{riga.codice_articolo}}</a></b></td>
                <td class="odd-detail">{{riga.descrizione|nonone}} {{riga.aggiuntalottoindescrizione}}</td>
                <td class="odd-detail" colspan="2">{{riga.listino}}</td>
                <td class="odd-number" colspan="2">{{utils.mNLC(riga.valore_unitario_lordo,2)}}</td>
                <td class="odd-detail" colspan="2">{{utils.getStringaSconti(utils.getScontiFromDao(riga.sconti)[0])}}</td>
                <td class="odd-number" colspan="2">{{utils.mNLC(riga.valore_unitario_netto,2)}}</td>
                <td class="odd-number" colspan="2" >{{utils.mN(riga.quantita,2)}}</td>
                {% if riga.moltiplicatore > 1 %}
                <td class="odd-number" colspan="2">{{riga.multiplo}} ( {{utils.mN(riga.moltiplicatore,2)}} )</td>
                {% else %}
                <td class="odd-number" colspan="2"></td>
                {% endif %}
                <td class="odd-number" colspan="2">{{riga.percentuale_iva|int}}</td>
                <td class="odd-number" colspan="3"><strong>{{utils.mNLC(( riga.quantita*  riga.moltiplicatore * riga.valore_unitario_netto ),2)}}<strong></td>
            </tr>
            {% endfor %}
            <tr>
                    <td colspan="20" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td>
                </tr>
        </table>
<br>
<table cellpadding="4" cellspacing="1" border="0">
<tr><td width="50%">
    <table cellpadding="4" cellspacing="1" border="0">
        <tr><td colspan="6" class="table-header">Pagamento </td></tr>
        <tr><td colspan="6" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
            <tr>
                <td width="140px" class="even-detail">Pagamento</td>
                <td class="odd-detail"><strong>{{dao.pagamento}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Banca</td>
                <td class="odd-detail"><strong>{{dao.banca}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Aliquota esenzione</td>
                <td class="odd-detail"><strong>{{dao.aliquota_iva_esenzione}}</strong></td>
            </tr>
            <tr><td colspan="6" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
    </table>
</td><td width="50%">
        <table cellpadding="4" cellspacing="1" border="0">
            <tr><td colspan="6" class="table-header">Aspetto beni</td></tr>
            <tr><td colspan="6" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
            <tr>
                <td width="175px" class="even-detail">Aspetto esteriore beni</td>
                <td class="odd-detail"><strong>{{dao.aspetto_esteriore_beni}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Totale colli</td>
                <td class="odd-detail"><strong>{{dao.totale_colli}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Totale peso</td>
                <td class="odd-detail"><strong>{{dao.totale_peso}}</strong></td>
            </tr>
            <tr><td colspan="6" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
    </table>
</td></tr>
</table>
    <table cellpadding="4" cellspacing="1" border="0">
      <tr><td colspan="6" class="table-header">Totale Contabilita'</td></tr>
        <tr><td colspan="6" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
        <tr>
            <td class="even-detail" colspan="2">Totale Sospeso</td>
            <td class="odd-detail">
                <strong py:if="conf.hasPagamenti == True">
                    <strong>{{utils.mNLC(dao.totale_sospeso|nonone,2)}}</strong></strong></td>
            <td class="even-detail" colspan="2">Totale Pagato</td>
            <td class="odd-detail">
                <strong py:if="conf.hasPagamenti == True">
                    <strong>{{utils.mNLC(dao.totale_pagato|nonone,2)}}</strong></strong></td>
        </tr>
        <tr><td colspan="15" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
    </table>
    <table cellpadding="4" cellspacing="1" border="0">
  <tr><td colspan="6" class="table-header">Trasporto</td></tr>
    <tr><td colspan="6" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
            <tr>
                <td class="even-detail">Incaricato trasporto</td>
                <td class="odd-detail" width="150px"><strong>{{dao.incaricato_trasporto}}</strong></td>
                <td class="even-detail" colspan="2">Vettore</td>
                <td class="odd-detail" colspan="2"><strong>{{dao.ragione_sociale_vettore}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Inizio trasporto</td>
                <td class="odd-detail">
                    <strong py:if="dao.inizio_trasporto is not None">
                        <strong>{{utils.dateTimeToString(dao.inizio_trasporto)}}</strong>
                    </strong>
                </td>
            <td class="even-detail" colspan="2">Fine trasporto</td>
                <td class="odd-detail" colspan="2">
                    <strong py:if="dao.fine_trasporto is not None">
                        <strong>{{utils.dateTimeToString(dao.fine_trasporto)}}</strong>
                    </strong>
                </td>
            </tr>
            <tr><td colspan="6" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
            <tr><td colspan="6"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>

            <tr>
                <td colspan="6" class="table-header">Destinazione merce</td>
            </tr>
            <tr><td colspan="6" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>

            <tr>
                <td class="even-detail" width="150px">Destinazione</td>
                <td class="odd-detail"><strong>{{dao.destinazione_merce}}</strong></td>
                <td class="even-detail" width="80px">Indirizzo</td>
                <td class="odd-detail" colspan="3"><strong>{{dao.indirizzo_destinazione_merce}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Localita'</td>
                <td class="odd-detail">
                    <strong>{{dao.localita_destinazione_merce}}</strong>
                </td>
                <td class="even-detail">CAP</td>
                <td class="odd-detail"><strong>{{dao.cap_destinazione_merce}}</strong></td>
                <td class="even-detail">Provincia</td>
                <td class="odd-detail" width="50px"><strong>{{dao.provincia_destinazione_merce}}</strong></td>
            </tr>
        <tr><td colspan="6" class="Div01"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
        </table>
       <table cellpadding="4" cellspacing="1" border="0">
        <tr>
                <td colspan="2" class="table-header">Note</td>
            </tr>
        <tr><td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
            <tr>
                <td width="23%" class="even-detail">Note interne</td>
                <td width="77%" class="odd-detail"><strong>{{dao.note_interne}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Note pie' pagina</td>
                <td class="odd-detail"><strong>{{dao.note_pie_pagina}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Causale trasporto</td>
                <td class="odd-detail"><strong>{{dao.causale_trasporto}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">Protocollo</td>
                <td class="odd-detail"><strong>{{dao.protocollo}}</strong></td>
            </tr>
            <tr>
                <td class="even-detail">TOTALE RICARICATO LORDO:</td>
                 <td style="width:70px;" class="odd-detail"><strong>{{utils.mNLC(dao._totaleRicaricatoLordo,2)}} --
                    ({{utils.mNLC(dao._totaleRicaricatoImponibile,2)}} || {{utils.mNLC(dao._totaleRicaricatoIva,2)}} )
                     </strong></td>
            </tr>
        <tr><td colspan="2" class="Div02"><img src="/templates/giustopeso/img/trasparente.gif" border="0" width="10" height="9"></td></tr>
        </table>
        {% else %}
        <p><img src= "gui/attenzione_48X48.png">ELIMINATO: Niente da visualizzare</p>
        <p><img src= "gui/testata_promogest2.png"></p>
        {% endif %}
{% endblock %}
    <br><br>
    <a class="torna_allo_storico" href="#" dao="cliente" id="{{pageData['daoCliente'].id}}">
        <button type="button">Torna allo storico ordini</button>
    </a><br><br>
